package data;

import com.EntityName;
import com.google.appengine.api.datastore.Entity;

public class DateTimeFormatMaster extends AbstractData {
	private long id = -1;
	private String dateTimeFormat;
	private String type;
	
	public DateTimeFormatMaster(){}
	
	public DateTimeFormatMaster(long id)
	{
		this.id = id;
	}
	@Override
	public long getId() {
		return id;
	}
	
	public String getDateTimeFormat() {
		return dateTimeFormat;
	}

	public void setDateTimeFormat(String dateTimeFormat) {
		this.dateTimeFormat = dateTimeFormat;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}

	@Override
	public Entity getEntity() {
		Entity item;
		if(this.key == null)
			item = new Entity(EntityName.DateTimeFormat);
		else
			item = new Entity(this.key);

		item.setProperty("dateTimeFormat", this.dateTimeFormat);
		item.setProperty("type", this.type);
		return item;
	}
	@Override
	public void setEntity(Entity entity) {
		this.id = entity.getKey().getId();
		this.dateTimeFormat = (String) entity.getProperty("dateTimeFormat");
		this.type = (String) entity.getProperty("type");
		this.key = entity.getKey();
	}
	
	public void LoadData() {
		if (this.id > -1) {
			Entity entity = LoadData(EntityName.DateTimeFormat, this.id);
			setEntity(entity);
		}
	}

}
